package com.example.yiwei.crm.view.activity.jdjycooractivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.yiwei.crm.R;
import com.example.yiwei.crm.data.GetContact;
import com.example.yiwei.crm.data.GetCustumer;
import com.example.yiwei.crm.entity.ContactMessageEntity;
import com.example.yiwei.crm.entity.CustomerMessageEntity;

public class JDJYDetileCustomerActivity extends AppCompatActivity {
    TextView txt_name,txt_manager,txt_age,txt_gender,txt_IDNumber,txt_security_numbers,
            txt_xzqy,txt_department,txt_creater,txt_qdfl,txt_qdly,txt_jdr,
            txt_create_date,txt_updater,txt_main_contact,txt_phone;
    ContactMessageEntity contact;
    CustomerMessageEntity customer;
    private ImageView img_find,img_luru;
    private ImageView img_me,img_tj;
    private ImageView img_back;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jdjydetile_customer);
        txt_qdfl= (TextView) findViewById(R.id.fragment_customer_other_base_qdfl);
        img_back = (ImageView) findViewById(R.id.health_education_img_back);
        img_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        txt_qdly= (TextView) findViewById(R.id.fragment_customer_other_base_qdly);
        txt_jdr= (TextView) findViewById(R.id.fragment_customer_other_base_jdr);
        img_find= (ImageView) findViewById(R.id.item_image_cx);
        img_luru= (ImageView) findViewById(R.id.item_image_lr);
        img_me= (ImageView) findViewById(R.id.item_image_w);
        img_tj= (ImageView) findViewById(R.id.item_image_tj);
        txt_name= (TextView)findViewById(R.id.fragment_customer_base_customerName);
        txt_manager= (TextView) findViewById(R.id.fragment_customer_base_manager);
        txt_age= (TextView) findViewById(R.id.fragment_customer_base_customerAge);
        txt_gender= (TextView) findViewById(R.id.fragment_customer_base_customergender);
        txt_IDNumber= (TextView) findViewById(R.id.fragment_customer_base_customer_IDNumber);
        txt_security_numbers= (TextView) findViewById(R.id.fragment_customer_base_security_numbers);
        //显示行政区域的文本框
        txt_xzqy= (TextView) findViewById(R.id.fragment_customer_base_xzqy);
        txt_department = (TextView) findViewById(R.id.fragment_customer_other_base_department);
        txt_creater = (TextView) findViewById(R.id.fragment_customer_other_base_create_people);
        txt_create_date = (TextView) findViewById(R.id.fragment_customer_other_base_create_date);
        txt_updater = (TextView) findViewById(R.id.fragment_customer_other_base_update_people);
        txt_main_contact= (TextView) findViewById(R.id.fragment_detailed_other_txt_main_contact);
        txt_phone= (TextView) findViewById(R.id.fragment_detailed_other_txt_phone);
        customer = GetCustumer.get();
        contact = GetContact.get();
        initData();
        img_luru.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(JDJYDetileCustomerActivity.this, JDJYCoorActivity.class);
                intent.putExtra("lr","lr");
                startActivity(intent);
                finish();
            }
        });
        img_find.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(JDJYDetileCustomerActivity.this, JDJYCoorActivity.class);
                intent.putExtra("ii","ii");
                startActivity(intent);
                finish();
            }
        });
        img_me.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(JDJYDetileCustomerActivity.this, JDJYCoorActivity.class);
                intent.putExtra("me","me");
                startActivity(intent);
                finish();
            }
        });
        img_tj.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(JDJYDetileCustomerActivity.this, JDJYCoorActivity.class);
                startActivity(intent);
                finish();
            }
        });
    }
    private void initData() {
        txt_name.setText(customer.getClient_name());
        txt_manager.setText(customer.getClient_manager_name());
        txt_age.setText(String.valueOf(customer.getClient_age()));
        if (customer.getClient_gender()!=0){
            if (customer.getClient_gender()==1){
                txt_gender.setText("男");
            }else if (customer.getClient_gender()==2){
                txt_gender.setText("女");
            }
        }else{
            txt_gender.setText("性别未填写");
        }
        txt_IDNumber.setText(customer.getIDNumber());
        txt_jdr.setText(customer.getJd());
        txt_qdly.setText(customer.getChannel_source());
        txt_qdfl.setText(customer.getChannel_classification());
//        if (1==customer.getRhfk()){
//            txt_rhfk.setText("未表态");
//        }
//        if (2==customer.getRhfk()){
//            txt_rhfk.setText("糊涂");
//        }
//        if (3==customer.getRhfk()){
//            txt_rhfk.setText("语言沟通障碍");
//        }
//        if (4==customer.getRhfk()){
//            txt_rhfk.setText("未见面");
//        }
//        if (5==customer.getRhfk()){
//            txt_rhfk.setText("无自主活动能力");
//        }
//        if (6==customer.getRhfk()){
//            txt_rhfk.setText("拒绝沟通");
//        }
//        if (7==customer.getRhfk()){
//            txt_rhfk.setText("不能说积分");
//        }
//        if (8==customer.getRhfk()){
//            txt_rhfk.setText("有介绍意向");
//        }
//        if (9==customer.getRhfk()){
//            txt_rhfk.setText("介绍意向强");
//        }
//        if (10==customer.getRhfk()){
//            txt_rhfk.setText("家属有介绍意向");
//        }
//        if (11==customer.getRhfk()){
//            txt_rhfk.setText("准优质会员");
//        }
//        if (12==customer.getRhfk()){
//            txt_rhfk.setText("亲友近视眼");
//        }
//        if (13==customer.getRhfk()){
//            txt_rhfk.setText("无意向");
//        }
//        if (14==customer.getRhfk()){
//            txt_rhfk.setText("征兵入伍");
//        }
//        if (15==customer.getRhfk()){
//            txt_rhfk.setText("其他");
//        }
//        if (1==customer.getHydj()){
//            txt_hydj.setText("A");
//        }
//        if (2==customer.getHydj()){
//            txt_hydj.setText("B");
//        }
//        if (3==customer.getHydj()){
//            txt_hydj.setText("C");
//        }
//        if (4==customer.getHydj()){
//            txt_hydj.setText("VIP");
//        }
//        if (5==customer.getHydj()){
//            txt_hydj.setText("回收组");
//        }
        txt_department.setText(customer.getBelongs_department());
        txt_create_date.setText(customer.getCreate_time());
        txt_creater.setText(customer.getCurrent_create_user_name());
        txt_updater.setText(customer.getCurrent_update_user_name());
        txt_main_contact.setText(contact.getContact_name());
        txt_phone.setText(contact.getFirst_contact_mobile_phone());
        txt_security_numbers.setText(customer.getSecurity_numbers());
        if (customer.getPname()!=null) {
            txt_xzqy.setText(customer.getPname() + customer.getCname() + customer.getAname());
        }
    }
}
